package org.javarosa.mesh4j.sync.security;

import org.javarosa.core.JavaRosaServiceProvider;
import org.javarosa.core.services.properties.JavaRosaPropertyRules;
import org.mesh4j.sync.security.IIdentityProvider;

public class LoggedUserIdentityProvider implements IIdentityProvider{
	
	public static final LoggedUserIdentityProvider INSTANCE = new LoggedUserIdentityProvider();

	// MODEL VARIABLES
	private String loggedUser = "admin";
	
	// BUSINESS METHODS
	
	public String getAuthenticatedUser(){
		String deviceId = JavaRosaServiceProvider.instance().getPropertyManager().getSingularProperty(JavaRosaPropertyRules.DEVICE_ID_PROPERTY);
		return deviceId.concat("_").concat(this.loggedUser);
	}

	public String getLoggedUser() {
		return loggedUser;
	}

	public void setLoggedUser(String loggedUser) {
		this.loggedUser = loggedUser;
	}
}